Face Mask Detection

The following notebook is an exercise for the Convolutional Neural Networks for Computer Vision course at Afeka College of Engineering.
It uses Kaggle's Face Mask Detection dataset for Multi-Label Object Detection.

Table of Contents:

Submitted By:

Imports

Configurations

Data Load

Load the data into a dataset

Data Exploration

Images and Labels Count

Classes Distribution

Classes Combinations Distribution

Clearly, the data in these charts show a very imbalanced trend.
Only 123 faces have an incorrectly worn mask, appearing in (21 + 30 + 4 + 42) = 97 images, which is (97 / 853) = 11% of all the images.
However, the masks appeared on 768 / 853 = 90% of all images.
In later stages of training, it will be necessary to divide the train and validation sets evenly to preserve the different labels at the same percentage.

Number of Faces per Image

Splitting the Data

The data is very imbalanced, as it has been shown above.
The number of appearances of each class varies greatly, as well as the amount of faces per image.
We would like to use Cross-Validation for better training.
Due to our data being imbalanced, using standard splitting methods can cause some classes to not appear at all in some folds; Moreover, our task involves Multi-label Object Detection, for which the well-known splitting algorithm cannot be used.
Stratified KFold splits the folds by preserving the percentages of samples for each label.
Scikit-learn's algorithm cannot be applied to the second problem, so we will utilize the MultilabelStratifiedKFold implementation, which can be found here.

From the chart above, it can be seen that MultilabelStratifiedKFold split the images into almost identical train-test sizes in each fold, while preserving the number of labels from each class within each fold.

Data Samples

Real Data Samples

Augmentation Samples

Training

Graphs

It's best to look at Tensorboard, but for a quick glance, here are a few examples.

Graphs per Fold

Average Loss

Box Regression Loss

Classifier Loss

Objectness Loss

RPN Box Regression Loss

Learning Rate

Entire Model

To better understand the learning progress of the model over time, it would be useful to analyze the graph of the folds as a series.

Average Loss

Box Regression Loss

Classifier Loss

Objectness Loss

RPN Box Regression Loss

Learning Rate

Evaluation

Examples

Mean Average Precision

mAP@[0.5:0.05:0.95]

References